1. Field of the Invention
The present invention relates to an apparatus for measuring a distance to an object by processing an image picked up by a stereo camera.
2. Description of the Related Art
A well-known type of distance measuring apparatus measures a distance to an object by splitting a picture plane into small squares and finding the parallax of each of the squares in stereovision as disclosed in, for example, "Measurement of Distance between Cars in Stereovision Using Matching for Each Region", Institute of Television Engineering Technical Report, Jun. 24, 1988.
Furthermore, Japanese Patent Application Laid-Open No. 2-232512 discloses an apparatus which sets a single wide window and successively updates the setting of the window to track an object in the window.
FIG. 6 explains the principle of measuring a distance R through triangulation by using a pair of optical systems comprising a pair of lenses 1 and 11 with a focal length f and a pair of image sensors 2 and 12. The optical axes of the lenses 1 and 11 are set apart from each other by a base length L, and the image sensors 2 and 12 are respectively located at a distance of the focal length of from the lenses 1 and 11. When it is assumed that an amount of displacement between a first image of an object in a first picture plane picked up by the upper image sensor 2 and a second image of the object in a second picture plane picked up by the lower image sensor 12 is represented by a+b, the distance R is given by the following expression: EQU R=f.multidot.L/(a+b)
In such a distance measuring apparatus, image signals are passed through A/D converters 3 and 13 and stored in memories 4, 5 and 14, and distance calculations are carried out by a calculating unit in the form of a computer 6.
Specifically, a displacement between the first and second images of the object is detected by enclosing the first image with a window and comparing the first image in the window with the second image in the second picture plane, as shown in FIG. 7.
Assuming that the position of the window is expressed in pixel positions in the upper image sensor, the window is formed from a matrix of pixels with m rows and n columns which starts with a point in i-th row and j-th column and ends with a point in (i+m)-th row and (j+n)-th column.
When it is assumed that an image signal level at a point (u, v) in the first picture plane is S.sup.1 u,v and that an image signal level at a point (u, v) in the second plane is S2u,v, an image in the first picture plane most matching with an image in the second picture plane is found from a hatched area in the second plane according to the following expression. EQU S(q)=.SIGMA..SIGMA..vertline.S.sup.1 u,v-S.sup.2 u,v+q.hoarfrost.
where q is a variable; v is a value ranging from j to j+n; and u is a value ranging from i to i+m.
FIG. 8 is a graph showing the value of S(q) when the value q is changed in the above expression. In this graph, a value q.sub.o which gives the minimum value of S(q) corresponds to an amount of displacement of the first image relative to the second image.
Assuming that the pixel pitch is P, the distance R to the object is determined as follows. EQU R=f.multidot.L/P.multidot.q.sub.o
FIG. 9 shows another conventional distance measuring apparatus for performing distance measurement by using a plurality of sub-windows which are formed by splitting a picture plane into a plurality of squares of equal size.
Let us assume that the horizontally x-th and vertically y-th square is represented by (x, y) and the distance to an object in the square is represented by R(x, y). In this case, R(x, y) can be determined in the same manner as above.
In other words, when each square is formed from a matrix with m rows and n columns, the square (x, y) corresponds to a window starting with a point in m(x-1)-th row and n(y-1)-th column and ending with a point in mx-th row and ny-th column. Therefore, the distance R(x, y) to an object in each square can be found in the same manner as mentioned in the above prior art.
Since the distances to respective parts of the object can be found in this method, the outline of the object can be determined based on data on R(x, y).
In the above-described conventional distance measuring apparatus in which the size of a sub-window is fixed, if the area of each sub-window is so wide as to allow objects other than a target object to come into the wide sub-window, a target object such as a preceding car will often be difficult to recognize and an exact distance to the target object cannot be measured.
On the other hand, if each sub-window is so small that an image of a target object in the sub-window may occupy the entire area of the sub-window (i.e., the area of the target image is equal to or greater than that of the sub-window), there will be no valid contrast in the respective portions of the sub-window and therefore the recognition of the object will be difficult, thus making it impossible to measure the distance to the target object. Furthermore, in this case, the number of effective data contained in such a small sub-window is so limited that the distance measurement, if possible, can be subject to the adverse influence of noise, thus inducing large errors in the measurement.